﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        window.onload = function () {
            document.getElementById("radiogrp").onclick = function () {
                var radios = this.querySelectorAll("input[type='radio'][name='method']");

                var choice;
                for (var i = 0; i < radios.length; i++) {
                    var radio = radios[i];
                    if (radio.checked) {
                        choice = radio.value;
                        break;
                    }
                }

                document.getElementById("result").innerHTML = choice;
            };
        };
    </script>
</head>
<body>
    <fieldset id="radiogrp">
        <legend>Shipping Method</legend>
        <label>
            <input type="radio" name="method" value="1st" checked="checked" />First-class</label>
        <label>
            <input type="radio" name="method" value="2day" />2-day Air</label>
        <label>
            <input type="radio" name="method" value="overnite" />Overnight</label>
    </fieldset>
    <p id="result">
        not selected yet</p>
</body>
</html>
